from dataclasses import dataclass
from typing import Protocol

from src.application.category.dto import CategoryDTO
from src.application.server.enums import ServerPrivacy, ServerType
from src.domain.common.constants import Empty, OrderBy
from src.domain.server.entities.category import CategoryEntity


@dataclass(frozen=True)
class GetCategoriesFilters:
    proxy_type: ServerType
    proxy_privacy: ServerPrivacy
    country_id: int
    provider_id: int
    offset: int | Empty = Empty.UNSET
    limit: int | Empty = Empty.UNSET
    order_by: OrderBy = OrderBy.ASC


class CategoryReader(Protocol):
    async def get_category_by_id(self, category_id: int, joined: bool = False) -> CategoryDTO:
        raise NotImplementedError

    async def get_category_by_name(self, category_name: str) -> CategoryDTO:
        raise NotImplementedError

    async def get_category_for_private(self, country_id: int, provider_id: int) -> CategoryDTO:
        raise NotImplementedError

    async def filter_categories(self, filters: GetCategoriesFilters) -> list[CategoryDTO]:
        raise NotImplementedError
